import axios from "axios";

// 首页初始数据
export function index(category) {
    return axios.get('index', {
        params: {category}
    });
}

// 首页话题列表分页数据
export function category(type = 'nav') {
    return axios.get('category', {
        params: {type}
    });
}

// 首页话题列表分页数据
export function topic(categoryId, page, per_page, order = '') {
    return axios.get('topic/' + categoryId, {
    params: {
        page,
        per_page,
        order
    }
    });
}

// 发布话题
export function publish(title, category_id, body) {
    return axios.post('publish', {
        title,
        category_id,
        body
    })
}

// 编辑话题
export function editPublish(id, title, category_id, body) {
    return axios.post('publish/' + id, {
        title,
        category_id,
        body
    })
}

// 文章详情
export function article(id) {
    return axios.get('article/' + id);
}

// 广告位
export function advertising(id) {
    return axios.get('advertising/' + id);
}